/* 全局样式 */
:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --background-color: #f8fafc;
    --text-color: #1f2937;
    --border-color: #e5e7eb;
    --success-color: #059669;
    --error-color: #dc2626;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

header p {
    font-size: 1.2rem;
    color: #666;
}

/* 输入区域样式 */
.input-section {
    margin-bottom: 2rem;
}

.url-input {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

input[type="url"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input[type="url"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

button {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--secondary-color);
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* 加载动画 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 错误提示 */
.error {
    padding: 1rem;
    background-color: #fee2e2;
    border: 1px solid var(--error-color);
    border-radius: 0.5rem;
    color: var(--error-color);
    margin: 1rem 0;
}

/* 预览区域样式 */
.preview-section {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #f9fafb;
    border-bottom: 1px solid var(--border-color);
}

.preview-header h2 {
    font-size: 1.25rem;
    color: var(--text-color);
}

.preview-container {
    padding: 2rem;
    min-height: 300px;
    max-height: 600px;
    overflow-y: auto;
}

/* Markdown 样式 */
.markdown-body {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-color);
    animation: fadeIn 0.3s ease-in-out;
}

.markdown-body h1 {
    font-size: 2rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin: 1.5rem 0;
}

.markdown-body h2 {
    font-size: 1.5rem;
    color: var(--secondary-color);
    margin: 1.2rem 0;
}

.markdown-body h3 {
    font-size: 1.25rem;
    margin: 1rem 0;
}

.markdown-body ul {
    list-style-type: none;
    padding-left: 1.5rem;
}

.markdown-body li {
    position: relative;
    margin: 0.5rem 0;
}

.markdown-body li::before {
    content: "•";
    color: var(--primary-color);
    position: absolute;
    left: -1.2rem;
    font-size: 1.2em;
}

/* 页脚样式 */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 1rem;
    color: #666;
}

/* 预览操作按钮 */
.preview-actions {
    display: flex;
    gap: 1rem;
}

.secondary-button {
    background-color: #f3f4f6;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.secondary-button:hover {
    background-color: #e5e7eb;
}

.secondary-button:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
}

/* 代码块样式 */
.code-block-wrapper {
    position: relative;
    margin: 1rem 0;
}

.code-block-wrapper pre {
    margin: 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    overflow-x: auto;
}

.copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.code-block-wrapper:hover .copy-button {
    opacity: 1;
}

/* 链接样式 */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* 美化滚动条 */
.preview-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.preview-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.preview-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.preview-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .url-input {
        flex-direction: column;
    }
    
    button {
        width: 100%;
    }
    
    .preview-container {
        padding: 1rem;
    }
    
    .preview-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .preview-actions button {
        width: 100%;
    }
    
    .copy-button {
        opacity: 1;
        position: static;
        margin-top: 0.5rem;
        width: 100%;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 美化引用块 */
.markdown-body blockquote {
    padding: 0.5rem 1rem;
    margin: 1rem 0;
    border-left: 4px solid var(--primary-color);
    background-color: #f8fafc;
    color: #4b5563;
}

/* 美化表格 */
.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

.markdown-body table th,
.markdown-body table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
}

.markdown-body table th {
    background-color: #f9fafb;
    font-weight: 600;
}

.markdown-body table tr:nth-child(even) {
    background-color: #f8fafc;
}

/* 美化分割线 */
.markdown-body hr {
    height: 2px;
    background-color: var(--border-color);
    border: none;
    margin: 2rem 0;
} 